import {Message, Loading} from "element-ui";

// 对 $message 进行二次封装
export function showMessage(type, msg) {
    const loadingInstance = Loading.service({
        lock: true,
        spinner: 'el-icon',
        background: 'rgba(0, 0, 0, 0.7)'
    })
    Message({
        showClose: true,    // 是否显示关闭按钮
        type: type,
        message: msg,
        duration: 2000,    // 延长关闭时间
        dangerouslyUseHTMLString: true, // 是否编译HTML
        onClose() {
            // 关闭遮罩
            loadingInstance.close()
        },
    })
}